declare namespace dc = "http://purl.org/dc/elements/1.1/";
declare namespace pm = "http://www.politicalmashup.nl";
declare namespace xsi = "http://www.w3.org/2001/XMLSchema-instance";

import module namespace partintmod="http://www.example.com/partintmod" at "xmldb:exist:///db/projdb/modules/partint_mod.xqm";

let $doc := collection('/db/projdb/ge-2009')
let $speaker_file := doc('/db/projdb/lijst_van_sprekers_ge2009.xml')
let $output_collection := 'xmldb:exist:///db/projdb'
(: periodes to investigate :)
let $periods := ('2009-2010', '2010-2011', '2011-2012', '2012-2013', '2013-2014')


    return element messages {
        for $period in $periods
            let $filename := concat('initiators_and_participants_ge2009_', $period, '.xml')
            return partintmod:create_initiators_and_participants($doc[data(./root//pm:legislative-period) = $period], $speaker_file, $output_collection, $filename )
        ,partintmod:create_initiators_and_participants($doc, $speaker_file, $output_collection,'initiators_and_participants_ge2009.xml')
        }